<template>
	<BaseContainer>
		<aplid-base-crud ref="crud" class="w-100" v-bind="baseConfig" :operateFormate="operateFormate">
			<template v-slot:subprojectIdForm="{ row, model }">
				<AplidAutoSelect
					:key="model.belongProject"
					v-bind="row"
          v-if="model.belongProject"
					:paramsObj="{
						belongProject: model.belongProject,
						delFlag: 0,
            bindCreditCode:userInfo.organizationId
					}"
					v-model:modelValue="model.subprojectId"
					v-model:modelName="model.subprojectName"
				></AplidAutoSelect>
			</template>
			<template v-slot:spotDialog="{ show, row }">
				<SpotList :nowRowData="row" v-if="show"></SpotList>
			</template>
		</aplid-base-crud>
	</BaseContainer>
</template>

<script setup>
import { baseConfig } from './config'
import SpotList from './SpotList/index.vue'
import apiMod from '@/apiMod/index'
import { getStore } from '@/utils/store';

const userInfo = getStore('userInfo')||{}

const operateFormate = (form, type) => {
	return new Promise((resolve, reject) => {
		if (type == 'spot') {
			apiMod
				.view_omSpotBatch_spotCheck({
					id: form.id,
				})
				.then((res) => {
					resolve(form)
				})
			return
		}
		resolve(form)
	})
}
</script>

<style lang="scss" scoped></style>
